home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15948 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: watserv3.uwaterloo.ca!news
  3. From: ggdan@konec.uwaterloo.ca (T. Daniel Liebster)
  4. Subject: Re: malloc() function and new operator
  5. Message-ID: <DpKDyG.Gnn@watserv3.uwaterloo.ca>
  6. Sender: news@watserv3.uwaterloo.ca
  7. Nntp-Posting-Host: cnts2p24.uwaterloo.ca
  8. Organization: University of Waterloo
  9. X-Newsreader: Forte Free Agent 1.0.82
  10. References: <4kbo18$t1s@news.NetVision.net.il>
  11. Date: Mon, 8 Apr 1996 22:16:45 GMT
  12.  
  13. nir@netvision.net.il (Nir Sofer) wrote:
  14.  
  15. >I use in my C/C++ programs both malloc() function and new operator.
  16. >i use new and delete operators for objects and malloc() and free()
  17. >functions for allocating strings and other variables.
  18. >i compile my programs with Borland C++ 4.0 
  19. >it works fine, but i want to be sure that i'm not doing something
  20. >wrong that will cause troubles in the future.
  21.  
  22. >Is it o.k to use both of them in the same program ?
  23.  
  24. There is nothing wrong with using them both as long as you only use
  25. 'delete' on pointers that were returned by 'new' and only free()
  26. memory that was allocated using malloc().
  27.  
  28.  
  29. >Nir Sofer
  30. >nir@netvision.net.il
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.